package com.yykj.tencent.im.client.message;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 文本消息元素
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TIMTextMsgElement extends TIMMsgElement {
    @JsonProperty("MsgContent")
    private TextMsgContent msgContent;

    public TIMTextMsgElement() {
        super(MsgType.TIM_TEXT_ELEM);
    }

    public TIMTextMsgElement(TextMsgContent msgContent) {
        super(MsgType.TIM_TEXT_ELEM);
        this.msgContent = msgContent;
    }

    public TIMTextMsgElement(String text) {
        this(new TextMsgContent(text));
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class TextMsgContent {
        @JsonProperty("Text")
        private String text;
    }
}
